import logging

logger001 = logging.getLogger('test03')
logger001.setLevel(logging.DEBUG)

fh = logging.FileHandler('test03.log')
ch = logging.StreamHandler()

formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

fh.setFormatter(formatter)
ch.setFormatter(formatter)

logger001.addHandler(fh)
logger001.addHandler(ch)

logger001.debug('＃＃＃＃＃＃＃＃＃分割线＃＃＃＃＃＃＃')
logger001.debug('logger debug message')
logger001.info('logger info message')
logger001.warning('logger warning message')
logger001.error('logger error message')
logger001.critical('logger critical message')